# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=py3-awesomeversion
pkgver=23.8.0
pkgrel=0
pkgdesc="Python module to deal with versions"
url="https://github.com/ludeeus/awesomeversion"
license="MIT"
arch="noarch"
depends="python3"
makedepends="py3-gpep517 py3-installer py3-poetry-core"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://github.com/ludeeus/awesomeversion/archive/$pkgver/py3-awesomeversion-$pkgver.tar.gz
	version-placeholder.patch
	"
builddir="$srcdir/awesomeversion-$pkgver"

prepare() {
	default_prepare

	# set module version
	sed -i "s/@VERSION@/$pkgver/" pyproject.toml
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
31761a12e7c8192deb91873dac2e76b4a89389d67a1aa901d543dd14d89a1e06463eb0b200326d9e9e1a4c3618a26f159b63d1559210e7c0abb60f5df18f21cd  py3-awesomeversion-23.8.0.tar.gz
2f60fed1123467d581ed6ba172d25421ee3d8592729d1a922e7ba9de0ddace767bcd654acfce378bb056fd678027a27dc4a20047ef04c4c949eae89b2186d14b  version-placeholder.patch
"
